/**
 * 
 */
package com.es.dao;


import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import org.apache.log4j.Logger;

import com.es.dao.factory.SqlMapClientFactory;
import com.es.exception.dao.ESDataAccessException;
import com.es.model.Lead;
import com.es.model.Property;
import com.es.model.Value;
import com.es.util.ProjectConstant;
import com.ibatis.sqlmap.client.SqlMapClient;


/**
 * @author Bushra Nazir
 *
 */
public class PropertyDAO extends BaseDAO {

	private static final Logger log = Logger.getLogger(PropertyDAO.class);





	public List<Property> getLeadQualificationPropertyLisByUser(
			Lead selectedLeadToConvert, Integer businessRuleId) {


		List<Property> uniqueLeadQualificationRulePropertyList = new ArrayList<Property>();

		log.info("GETTING LIST OF UNSET PROPERTIES BY LEAD " + selectedLeadToConvert.getFirstname() );

		SqlMapClient sqlMap =  SqlMapClientFactory.getSqlMapClient();

		try {
			Hashtable<String, Object> paramMap = new Hashtable< String, Object>();

			paramMap.put( "leadId" , selectedLeadToConvert.getLeadId());
			paramMap.put( "businessRuleId", businessRuleId);

			uniqueLeadQualificationRulePropertyList = (ArrayList) sqlMap.queryForList(
					"property.selectUniqueQualificationRulePropertiesByLeadIdAndBusinessRuleId", paramMap);

			log.info("PROPERTY LIST SIZE : " + uniqueLeadQualificationRulePropertyList.size());
			return uniqueLeadQualificationRulePropertyList;

		} catch (Exception e) {
			log.error(e);
			throw new ESDataAccessException(e);
		}


		
	}




}
